<!DOCTYPE html>
<html>
<head>
	<title>没想到你是这样的宝宝</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection" />
	<meta content="emai=no" name="format-detection" />
	<link href="/assets/css/common.css" rel="stylesheet" />
	<script src="/assets/zepto-1.1.6.js"></script>
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>
<body style="margin:0">
	<input type="hidden" name="signature" id="signature" value="<?php echo $js_config['noncestr']?>">
	<button type="button" id="btn">按钮</button>
	<script type="text/javascript">
    Zepto(function ($) {

    	$("#btn").click(function(){
			$.ajax({
				url: "/test/test",
				type: "post",
				dataType: "json",
				success: function(res){
					 wx.config({
				            debug: false,
				            appId: '<?php echo $js_config['appId']?>',
				            timestamp: <?php echo $js_config['timestamp']?>,
				            nonceStr: '<?php echo $js_config['noncestr']?>',
				            signature: '<?php echo $js_config['signature']?>',
				            jsApiList: [
				            	'onMenuShareTimeline',
				            	'onMenuShareAppMessage'
				            ]
				        });
				        wx.ready(function () {
				        	wx.onMenuShareTimeline({
				            	title: res["share_content"],
				        	    link: res["share_url"], // 分享链接
				        	    imgUrl: 'http://wx.zhishimama.com/assets/images/share.jpg', // 分享图标
				        	    success: function () {
				        	        // 用户确认分享后执行的回调函数
				        	    },
				        	    cancel: function () {
				        	        // 用户取消分享后执行的回调函数
				        	    }
				        	});

				        	wx.onMenuShareAppMessage({
				            	title: res["share_content"],
				        	    desc: res["share_content"], // 分享描述
				        	    link: res["share_url"], // 分享链接
				        	    imgUrl: 'http://wx.zhishimama.com/assets/images/share.jpg', // 分享图标
				        	    type: 'link', // 分享类型,music、video或link，不填默认为link
				        	    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
				        	    success: function () {
				        	        // 用户确认分享后执行的回调函数
				        	    },
				        	    cancel: function () {
				        	        // 用户取消分享后执行的回调函数
				        	    }
				        	});
				        });
				}
			})

			
        });
        
        wx.config({
            debug: false,
            appId: '<?php echo $js_config['appId']?>',
            timestamp: <?php echo $js_config['timestamp']?>,
            nonceStr: '<?php echo $js_config['noncestr']?>',
            signature: '<?php echo $js_config['signature']?>',
            jsApiList: [
            	'onMenuShareTimeline',
            	'onMenuShareAppMessage'
            ]
        });
        wx.
		(function () {
        	wx.onMenuShareTimeline({
            	title: '<?php echo $share_content;?>',
        	    link: '<?php echo $share_url?>', // 分享链接
        	    imgUrl: 'http://wx.zhishimama.com/assets/images/share.jpg', // 分享图标
        	    success: function () {
        	        // 用户确认分享后执行的回调函数
        	    },
        	    cancel: function () {
        	        // 用户取消分享后执行的回调函数
        	    }
        	});

        	wx.onMenuShareAppMessage({
            	title: '<?php echo $share_desc?>',
        	    desc: '<?php echo $share_content;?>', // 分享描述
        	    link: '<?php echo $share_url?>', // 分享链接
        	    imgUrl: 'http://wx.zhishimama.com/assets/images/share.jpg', // 分享图标
        	    type: 'link', // 分享类型,music、video或link，不填默认为link
        	    dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
        	    success: function () {
        	        // 用户确认分享后执行的回调函数
        	    },
        	    cancel: function () {
        	        // 用户取消分享后执行的回调函数
        	    }
        	});
        });
    })
	</script>
</body>
</html>